#include <iostream>
#include <vector>
#include <list>

class MyHashSet {
private:
    std::vector<std::list<int>> buckets;
    static const int numBuckets = 10000;

public:
    /** Initialize your data structure here. */
    MyHashSet() : buckets(numBuckets) {}

    void add(int key) {
        int bucketIndex = key % numBuckets;
        for (int& value : buckets[bucketIndex]) {
            if (value == key) {
                return; 
            }
        }
        buckets[bucketIndex].push_back(key);
    }

    void remove(int key) {
        int bucketIndex = key % numBuckets;
        buckets[bucketIndex].remove(key);
    }

    /** Returns true if this set contains the specified element */
    bool contains(int key) {
        int bucketIndex = key % numBuckets;
        for (int& value : buckets[bucketIndex]) {
            if (value == key) {
                return true;
            }
        }
        return false;
    }
};

int main() {
    MyHashSet hashSet;

    hashSet.add(1);
    hashSet.add(2);
    hashSet.add(3);

    std::cout << "HashSet contains 2: " << hashSet.contains(2) << std::endl;
    std::cout << "HashSet contains 4: " << hashSet.contains(4) << std::endl;

    hashSet.remove(2);

    std::cout << "HashSet contains 2: " << hashSet.contains(2) << std::endl;

    return 0;
}